package com.lin.cms.domain;

import java.io.Serializable;
import java.util.Collection;


public class Groups implements Serializable {

	private static final long serialVersionUID = 1L;

	private int groupId;

	private String groupName;

	private int priority;

	private String needCaptcha;

	private String needCheck;

	private int allowPerDay;

	private int allowMaxFile;

	private String allowSuffix;

	private String isRegDef;

	public Groups() {
	}

	public int getGroupId() {
		return groupId;
	}

	public void setGroupId(int groupId) {
		this.groupId = groupId;
	}

	public String getGroupName() {
		return groupName;
	}

	public void setGroupName(String groupName) {
		this.groupName = groupName;
	}

	public int getPriority() {
		return priority;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}

	public String getNeedCaptcha() {
		return needCaptcha;
	}

	public void setNeedCaptcha(String needCaptcha) {
		this.needCaptcha = needCaptcha;
	}

	public String getNeedCheck() {
		return needCheck;
	}

	public void setNeedCheck(String needCheck) {
		this.needCheck = needCheck;
	}

	public int getAllowPerDay() {
		return allowPerDay;
	}

	public void setAllowPerDay(int allowPerDay) {
		this.allowPerDay = allowPerDay;
	}

	public int getAllowMaxFile() {
		return allowMaxFile;
	}

	public void setAllowMaxFile(int allowMaxFile) {
		this.allowMaxFile = allowMaxFile;
	}

	public String getAllowSuffix() {
		return allowSuffix;
	}

	public void setAllowSuffix(String allowSuffix) {
		this.allowSuffix = allowSuffix;
	}

	public String getIsRegDef() {
		return isRegDef;
	}

	public void setIsRegDef(String isRegDef) {
		this.isRegDef = isRegDef;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + groupId;

		return result;
	}
	
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		final Groups other = (Groups) obj;
		if (groupId != other.groupId)
			return false;

		return true;
	}
	
	@Override
	public String toString() {
		return getClass().getName() + "@" + Integer.toHexString(hashCode()) + 
			"(" + 
			"groupId=" + "'" + groupId + "'" + 
			")";
	}
	
	/**
	 * 从集合中提取ID数组
	 * 
	 * @param groups
	 * @return
	 */
	public static Integer[] fetchIds(Collection<Groups> groups) {
		Integer[] ids = new Integer[groups.size()];
		int i = 0;
		for (Groups g : groups) {
			ids[i++] = g.getGroupId();
		}
		return ids;
	}

	
}
